package com.yulebaby.callsenter.ui.view;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;

import com.yulebaby.callsenter.R;

/**
 * 投公海dialog
 *
 */
public class ToSeaSoonSaveDialog extends Dialog implements View.OnClickListener {

    private ToSeaSoonSaveDialog.DialogCallBack callback;
    private Context context;

    public ToSeaSoonSaveDialog(Context context, boolean isSuccess, ToSeaSoonSaveDialog.DialogCallBack callback) {
        super(context, R.style.NoBgDialogStyle);
        this.context = context;
        this.callback = callback;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
            View view = LayoutInflater.from(context).inflate(R.layout.dialog_toseasoon, null);
            view.findViewById(R.id.tv_lose).setOnClickListener(this);
            view.findViewById(R.id.tv_right).setOnClickListener(this);
            setContentView(view);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.tv_right:
                if (callback != null) {
                    callback.onConfirm(this);
                }
                break;
            case R.id.tv_lose:
                if (callback != null) {
                    callback.onCancel(this);
                }
                break;
        }
    }

    public interface DialogCallBack {
        void onConfirm(Dialog dialog);

        void onCancel(Dialog dialog);
    }
}
